#include<iostream>

using namespace std;


void test_array(){

    cout << "new 一维数组" << endl;

    int * p1 ;

    p1 = new int[4];

    cout << "delete 一维数组" << endl;

    delete [] p1;



    cout << "new 二维数组" << endl;

    int** p2 ;

    p2 = new int* [4]; 

    for( int i=0;i<4;i++){
        p2[i] = new int[8];
    }

     cout << "delete 二维数组" << endl;

    for( int i=0;i<4;i++){
       delete [] p2[i] ;
    }

    delete [] p2;

 

    cout << "new 三维数组" << endl;

    int*** p3 ;

    p3 = new int** [4]; 

    for( int i=0;i<4;i++){
        p3[i] = new int * [8];
        for(int j=0;j<8;j++){
            p3[i][j] = new int[9];
        }
    }

     cout << "delete 三维数组" << endl;


    for( int i=0;i<4;i++){
        for(int j=0;j<8;j++){
           delete[] p3[i][j] ;
        }
        delete [] p3[i] ;
    }

    delete [] p3;


}


